<?php
require './lib/ConnectDB.php';
$connect = ConnectDB::getInstace(); 
$id_img = mysqli_real_escape_string($connect->cDB(),$_POST['c_id_img']);
$id_user = mysqli_real_escape_string($connect->cDB(),$_POST['c_id_user']);
$comment = mysqli_real_escape_string($connect->cDB(),$_POST['comment']);
$date = time();

if(($id_img && $id_user && $comment) !=false)
{
 $connect->cDB()->query("INSERT INTO comments(id_img,id_user,comments,date,visible)
     values('$id_img','$id_user','$comment','$date','1')");  
 
header("Location:viewimg.php?id=$id_img");
    
}else
{
    
    echo "Полето за коментар трябва да е попълнено !";
}

